﻿// See https://aka.ms/new-console-template for more information

using Modbus.Net8.Modbus;
using System.Collections.Specialized;

//ushort crc = Crc16.ComputeChecksum(new byte[] { 0x17, 3, 0, 4, 0, 4 });

//byte[] data = RTU.GetSendBytes(1, 3, new byte[] { 0, 1, 0, 0x0c });
byte[] data = new byte[] { 0X5b };
string str = BitConverter.ToString(data);

ModbusData rtu;
ModbusData.ParseDataRtu(new byte[] { 0x17, 3, 8, 0, 0, 0, 0x39, 0x41, 0x25, 0x24, 0xE1, 0x9d, 0x25 }, true, out rtu);

//ASCII.GetSendBytes(1, 3, new byte[] { 0, 0, 0, 1 });
//ASCII.GetSendBytes(1, 4, new byte[] { 0x20, 0xc1, 0, 2, 1 });

//ModbusData ascii;
//ModbusData.PraseDataAscii(new byte[] { 0x3a, 0x30, 0x33, 0x30, 0x32, 0x30, 0x33, 0x35, 0x33, 0x36, 0x42, 0x30, 0x31, 0, 0, 0x0d, 0x0a }, true, out ascii);

//int cnt = new byte[] { 0x45, 7 }.FromBCD();
//byte[] bytes = 457.ToBCD();

//ModbusData tcp;
//ModbusData.ParseDataTcp(new byte[] { 0, 0, 0, 0, 0, 7, 1, 1, 4, 0xcd, 0x6b, 0xb2, 5 }, false, out tcp);

Console.WriteLine($"Hello, World!");
